﻿#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using System.Configuration;
using Gizmox.WebGuiSampleApplication;
using System.Data.Linq.SqlClient;

#endregion

namespace VisualWebGuiApplication2
{
    public partial class ManagerControl : UserControl
    {
     

        private int Index = 0;

        public BindingList<Tank_Stocks> _listoflsvwWaitingTanks;
        string DatetimeFormat = ConfigurationManager.AppSettings["DatetimeFormat"];
        private BindingList<Tank_Stocks> _ListlsvwStockTanks;
        private BindingList<Tank_Stocks> _ListlsvwoutofinvoiceTanks;
        private BindingList<Invoice> _listoflsvwInvoices;
        private BindingList<Accompanying_stocks> _listoflsvwStock;
        private BindingList<Accompanying_stocks_log> _listoflsvwStockLOG;
      //  private BindingList<Accompanying_stocks_log> _listoflsvwStock;
        private BindingList<Tank_Stocks> _ListlsvwFixingTanks;
        private BindingList<Tank_Stocks> _ListlsvwDestroyedtanks;
        private BindingList<Tank_Stocks> _ListlsvwDestroyedtanks2;

        private BindingList<Invoices2> _lstviewInvoiceWithMoney;
        //lstviewInvoiceWithMoney
       
        private int foundedTanks = 0;
        Tank_Stocks selected;
         public ManagerControl()
        {
            InitializeComponent();
         
           
            this.RightToLeft = Gizmox.WebGUI.Forms.RightToLeft.Yes;
            lsvwWaitingTanks.View = View.Details;
            lsvwFixingTanks.View = View.Details;
            lsvwStockTanks.View = View.Details;
            lsvwStock.View = View.Details;
            ListlsvwoutofinvoiceTanks.View = View.Details;
            listViewtankinvoice.View = View.Details;
            lsvwdestroyedtanks.View = View.Details;
            lsvwdestroyedtanks2.View = View.Details;
            lstviewInvoiceWithMoney.View = View.Details;


            lsvwdestroyedtanks.MouseClick += new MouseEventHandler(lsvwdestroyedtanks_MouseClick);
            lsvwdestroyedtanks2.MouseClick += new MouseEventHandler(lsvwdestroyedtanks2_MouseClick);
            ListlsvwoutofinvoiceTanks.MouseClick += new MouseEventHandler(listViewtankinvoiceoutofstock_MouseClick);
            lsvwStock.MouseClick += new MouseEventHandler(lsvwStock_MouseClick);
            listViewtankinvoice.MouseClick +=new MouseEventHandler(listViewtankinvoice_MouseClick);
         // listViewtankinvoice.MouseClick += new MouseEventHandler(lsvwStock_MouseClick);
             lsvwWaitingTanks.MouseClick += new MouseEventHandler(lsvwWaitingTanks_MouseClick);
             lsvwFixingTanks.MouseClick += new MouseEventHandler(lsvwFixingTanks_MouseClick);
             lsvwStockTanks.MouseClick += new MouseEventHandler(lsvwStockTanks_MouseClick);

             lstviewInvoiceWithMoney.MouseClick += new MouseEventHandler(lstviewInvoiceWithMoney_MouseClick);
             
            refreshPage();
        
           
        }

         void lstviewInvoiceWithMoney_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 0, 2, 1, 3);
         }

         void lsvwdestroyedtanks2_MouseClick(object sender, MouseEventArgs e)
         {
           
             ListView dd = (ListView)sender;
             gototab(dd, 1, 1, 5, 2);
         }

         void lsvwdestroyedtanks_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 1, 1, 5, 2);
         }

         void lsvwStockTanks_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 0, 1, 2,1);
         }

         void lsvwFixingTanks_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 1, 1, 5,2);
         }

         void lsvwWaitingTanks_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 1, 0, 4, 2);
         }

         void lsvwStock_MouseClick(object sender, MouseEventArgs e)
         {
             ListView dd = (ListView)sender;
             gototab(dd, 0, 2, 1,1);
         }
         void gototab(ListView dd,int maincontrol,int toolbar, int toolbarbutton,int toolbarnumber)
         {
             MainForm parent = (MainForm)this.ParentForm;
         
             this.ParentForm.Focus();
             if (null != dd.SelectedItem)
             {
                 if (!string.IsNullOrEmpty(dd.SelectedItem.Text))
                 {
                     parent.GoToInvoiceTab(dd.SelectedItem.Text, maincontrol, toolbar, toolbarbutton, toolbarnumber);
                 }
             }
         }
        
        void listViewtankinvoice_MouseClick(object sender, MouseEventArgs e)
         {
             
             // go to invoice page
             //ListView dd = (ListView)sender;
             //gototab(dd,0,2,3,1);

             ListView dd = (ListView)sender;
             //gototab(dd, 0, 2, 6, 6);
             gototab(dd, 0, 2, 6, 1);

             
         }

        void listViewtankinvoiceoutofstock_MouseClick(object sender, MouseEventArgs e)
         {
             
             // go to invoice page
             ListView dd = (ListView)sender;
             gototab(dd,0,2,3,1);

             //ListView dd = (ListView)sender;
             ////gototab(dd, 0, 2, 6, 6);
             //gototab(dd, 0, 2, 6, 1);

             
         }
		

       private void refreshPage()
       {
           foundedTanks = 0;
          
         
           FilllsvwWaitingTanks();
           FilllsvwDestroyedTanks();
           FilllsvwDestroyedTanks2();
           FilllsvwlsvwFixingTanks();
           FilllsvwlsvwStockTanks();
           FilllsvwlsvwStock();
           FilllsvwlsvwInvoices();
           FilllsvwlsvwInvoices2();
           
            Filllsvwlsvwtankinvoice();
            lblSizeFounded.Text = foundedTanks.ToString();
      
       }

       private void FilllsvwDestroyedTanks()
       {
           lsvwdestroyedtanks.Items.Clear();
           
               using (GazOnDevEntities db = new GazOnDevEntities())
               {
                   var query = from p in db.Tank_Stocks
                               where p.TankSystemStatus == "5"
                               select p;
                   queryDynamic(ref query);
                   query = query.OrderBy(b => b.Id);
                   _ListlsvwDestroyedtanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());



               }

          
         

           if (null != _ListlsvwDestroyedtanks)
           {
               foundedTanks += _ListlsvwDestroyedtanks.Count;
               lbllsvwDestroyedTanks.Text = _ListlsvwDestroyedtanks.Count.ToString();
           }
           foreach (Tank_Stocks item in _ListlsvwDestroyedtanks)
           {

               ListViewItem objItem = null;

               string tankTitle = "צובר " + item.Tank_Size + " גלון מספר " + item.TankNumber + "";
               objItem = this.lsvwdestroyedtanks.Items.Add(item.TankNumber);
               if ((Index % 2) == 0)
               {
                   objItem.BackColor = Color.AntiqueWhite;
               }
               else
               {
                   objItem.BackColor = Color.Azure;
               }

               Index++;
               objItem.SubItems.Add(tankTitle);

               objItem.SubItems.Add(item.manufacture_name);
               objItem.SubItems.Add(item.Datetime);
               objItem.SubItems.Add(item.GazCompanyName);
               objItem.SubItems.Add(item.GazDistributor);


           }
			
                
       }

       private void FilllsvwDestroyedTanks2()
       {
           lsvwdestroyedtanks2.Items.Clear();
          
               using (GazOnDevEntities db = new GazOnDevEntities())
               {
                   var query = from p in db.Tank_Stocks
                               where p.TankSystemStatus == "6"                               
                               select p;
                   queryDynamic(ref query);
                   query = query.OrderBy(b => b.Id);
                   _ListlsvwDestroyedtanks2 = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());



               }

           

           if (null != _ListlsvwDestroyedtanks2)
           {
               foundedTanks += _ListlsvwDestroyedtanks2.Count;
               lbllsvwDestroyed2Tanks.Text = _ListlsvwDestroyedtanks2.Count.ToString();
           }
           foreach (Tank_Stocks item in _ListlsvwDestroyedtanks2)
           {

               ListViewItem objItem = null;

               string tankTitle = "צובר " + item.Tank_Size + " גלון מספר " + item.TankNumber + "";
               objItem = this.lsvwdestroyedtanks2.Items.Add(item.TankNumber);
               if ((Index % 2) == 0)
               {
                   objItem.BackColor = Color.AntiqueWhite;
               }
               else
               {
                   objItem.BackColor = Color.Azure;
               }

               Index++;
               objItem.SubItems.Add(tankTitle);

               objItem.SubItems.Add(item.manufacture_name);
               objItem.SubItems.Add(item.Datetime);
               objItem.SubItems.Add(item.GazCompanyName);
               objItem.SubItems.Add(item.GazDistributor);


           }


       }
       private void Filllsvwlsvwtankinvoice()
       {



           listViewtankinvoice.Items.Clear();
            if (string.IsNullOrEmpty(txttanknumber.Text) && string.IsNullOrEmpty(txtSize.Text))
            {
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                   
                    if (!string.IsNullOrEmpty(txtmakatlog.Text))
                    {
                        var query = from p in db.Accompanying_stocks_log
                                    where p.makat ==txtmakatlog.Text
                                
                                    orderby p.Id descending
                                    select p;
                        _listoflsvwStockLOG = new BindingList<Accompanying_stocks_log>(query.ToList<Accompanying_stocks_log>());
                    }
                    else
                    {

                        var query = from p in db.Accompanying_stocks_log
                                   
                                orderby p.Id descending
                                select p;
                        _listoflsvwStockLOG = new BindingList<Accompanying_stocks_log>(query.ToList<Accompanying_stocks_log>());
                    }
                   
                   

                }
            }


            foreach (Accompanying_stocks_log item in _listoflsvwStockLOG)
            {
                
                ListViewItem objItem = null;


                objItem = this.listViewtankinvoice.Items.Add(item.Id.ToString());
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }
                
                Index++;
                objItem.SubItems.Add(item.makat);
                objItem.SubItems.Add(item.Title);
                objItem.SubItems.Add(item.Count );
                objItem.SubItems.Add(item.date);
                objItem.SubItems.Add(item.Unit);
                objItem.SubItems.Add(item.invoicenumber);
                objItem.SubItems.Add(item.supplier);
           
              
              
            }
			

       }


        /// <summary>
        /// Adds row to ListView
        /// </summary>
		private void FilllsvwWaitingTanks()
		{
            lsvwWaitingTanks.Items.Clear();
           
                
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Tank_Stocks
                                where p.TankSystemStatus == "2"
                              //  orderby p.Id ascending
                                select p;

                    queryDynamic(ref query);                                       
                    query = query.OrderBy(b => b.Id);
                    _listoflsvwWaitingTanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());
                   
                   

              

            }
            

            if (null != _listoflsvwWaitingTanks)
            {
                foundedTanks += _listoflsvwWaitingTanks.Count;
                lbllsvwWaitingTanks.Text = _listoflsvwWaitingTanks.Count.ToString();
            }
            foreach (Tank_Stocks item in _listoflsvwWaitingTanks)
            {
                
                ListViewItem objItem = null;
               
                string tankTitle="צובר "+item.Tank_Size+" גלון מספר "+item.TankNumber+"";
                objItem = this.lsvwWaitingTanks.Items.Add(item.TankNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }
                
                Index++;
                objItem.SubItems.Add(tankTitle);
              
                objItem.SubItems.Add(item.manufacture_name );
                objItem.SubItems.Add(item.Datetime);
                objItem.SubItems.Add(item.GazCompanyName);
                objItem.SubItems.Add(item.GazDistributor);
              
              
            }
			
                
			
		}

        private void queryDynamic(ref IQueryable<Tank_Stocks> query)
        {
            if (!string.IsNullOrEmpty(txtCompanyName.Text))
            {
                query = query.Where(b => b.GazCompanyName == txtCompanyName.Text);

            }
            if (!string.IsNullOrEmpty(txttanknumber.Text))
            {
                query = query.Where(b => b.TankNumber == txttanknumber.Text);

            }
            if (!string.IsNullOrEmpty(txtSize.Text))
            {
                query = query.Where(b => b.Tank_Size == txtSize.Text);

            }
        }

       
        private void FilllsvwlsvwFixingTanks()
		{
            this.lsvwFixingTanks.Items.Clear();
           
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Tank_Stocks
                                where p.TankSystemStatus == "3"                                
                                select p;
                    queryDynamic(ref query);
                    query = query.OrderBy(b => b.Id);
                    _ListlsvwFixingTanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());
                   
                  

                }
          
            
            if (null != _ListlsvwFixingTanks)
            {
                foundedTanks += _ListlsvwFixingTanks.Count;
                lbllsvwFixingTanks.Text = _ListlsvwFixingTanks.Count.ToString();
            }
            foreach (Tank_Stocks item in _ListlsvwFixingTanks)
            {
                
                ListViewItem objItem = null;
               
                string tankTitle="צובר "+item.Tank_Size+" גלון מספר "+item.TankNumber+"";
                objItem = this.lsvwFixingTanks.Items.Add(item.TankNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }
                
                Index++;
                objItem.SubItems.Add(tankTitle);
                
                objItem.SubItems.Add(item.manufacture_name );
                objItem.SubItems.Add(item.Datetime);
                objItem.SubItems.Add(item.GazCompanyName);
                objItem.SubItems.Add(item.GazDistributor);
            
              
            }
			
                
			
		}


        private void FilllsvwlsvwStockTanks()
		{
            lsvwStockTanks.Items.Clear();
           
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Tank_Stocks
                                where p.TankSystemStatus == "1"
                                select p;
                    queryDynamic(ref query);
                    query = query.OrderBy(b => b.Id);
                    _ListlsvwStockTanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());
                   
                    

                }           
           
            
            if (null != _ListlsvwStockTanks)
            {
                foundedTanks += _ListlsvwStockTanks.Count;
                lbllsvwStockTanks.Text = _ListlsvwStockTanks.Count.ToString();
            }
            foreach (Tank_Stocks item in _ListlsvwStockTanks)
            {
                
                ListViewItem objItem = null;
               
                string tankTitle="צובר "+item.Tank_Size+" גלון מספר "+item.TankNumber+"";
                objItem = this.lsvwStockTanks.Items.Add(item.TankNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }
                
                Index++;
                objItem.SubItems.Add(tankTitle);
                
                objItem.SubItems.Add(item.manufacture_name );
                objItem.SubItems.Add(item.Datetime);
                objItem.SubItems.Add(item.GazCompanyName);
                objItem.SubItems.Add(item.GazDistributor);
              
              
            }
			
                
			
		}



        private void FilllsvwlsvwStock()
		{
            lsvwStock.Items.Clear();
            if (string.IsNullOrEmpty(txttanknumber.Text) && string.IsNullOrEmpty(txtSize.Text))
            {
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                   
                    if (!string.IsNullOrEmpty(txtAccompanionStockTitle.Text))
                    {
                        var query = from p in db.Accompanying_stocks
                                    where p.Title.Contains(txtAccompanionStockTitle.Text) 
                                
                                    orderby p.Id descending
                                    select p;
                        _listoflsvwStock = new BindingList<Accompanying_stocks>(query.ToList<Accompanying_stocks>());
                    }
                    else
                    {

                        var query = from p in db.Accompanying_stocks
                                   
                                orderby p.Id descending
                                select p;
                        _listoflsvwStock = new BindingList<Accompanying_stocks>(query.ToList<Accompanying_stocks>());
                    }
                   
                   

                }
            }


            foreach (Accompanying_stocks item in _listoflsvwStock)
            {
                
                ListViewItem objItem = null;
               
                
                objItem = this.lsvwStock.Items.Add(item.makat);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }
                
                Index++;
                objItem.SubItems.Add(item.Title);
                objItem.SubItems.Add(item.Count );
           
              
              
            }
			
                
			
		}
        private void FilllsvwlsvwInvoices()
		{
            ListlsvwoutofinvoiceTanks.Items.Clear();
            
           
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Tank_Stocks
                                where p.TankSystemStatus == "4"
                                select p;
                    queryDynamic(ref query);
                    query = query.OrderBy(b => b.Id);
                    _ListlsvwoutofinvoiceTanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());



                }
           

            if (null != _ListlsvwoutofinvoiceTanks)
            {
                foundedTanks +=_ListlsvwoutofinvoiceTanks.Count;
                lbloutwithinvoice.Text = _ListlsvwoutofinvoiceTanks.Count.ToString();
            }
            foreach (Tank_Stocks item in _ListlsvwoutofinvoiceTanks)
            {

                ListViewItem objItem = null;

                string tankTitle = "צובר " + item.Tank_Size + " גלון מספר " + item.TankNumber + "";
                objItem = this.ListlsvwoutofinvoiceTanks.Items.Add(item.TankNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }

                Index++;
                objItem.SubItems.Add(tankTitle);

                objItem.SubItems.Add(item.manufacture_name);
                objItem.SubItems.Add(item.Datetime);
                objItem.SubItems.Add(item.GazCompanyName);
                objItem.SubItems.Add(item.GazDistributor);


            }
			
                
			
		}
         private void FilllsvwlsvwInvoices2()
		{
            lstviewInvoiceWithMoney.Items.Clear();

            if (string.IsNullOrEmpty(txttanknumber.Text))
            {
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Invoices2
                              
                                orderby p.id ascending
                                select p;
                    _lstviewInvoiceWithMoney = new BindingList<Invoices2>(query.ToList<Invoices2>());



                }
            }

           

            foreach (Invoices2 item in _lstviewInvoiceWithMoney)
            {

                ListViewItem objItem = null;

              //  string tankTitle = item.invoiceNumber;
                objItem = this.lstviewInvoiceWithMoney.Items.Add(item.invoiceNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }

                Index++;
                //objItem.SubItems.Add(tankTitle);
                if (null != item.date)
                {
                    objItem.SubItems.Add(item.date.ToString());
                }
                else
                {
                    objItem.SubItems.Add(string.Empty);
                }
                objItem.SubItems.Add(item.address);
                objItem.SubItems.Add(item.C_to);
                
                objItem.SubItems.Add(item.transporter);


            }
			
                
			
		}


        
        private void btnrefresh_Click(object sender, EventArgs e)
        {
         
            //if (string.IsNullOrEmpty(txttanknumber.Text)
            //    && string.IsNullOrEmpty(txtCompanyName.Text))
            //{
            //    refreshPage();
              
            //}
            //else
            //{
            //    ClearAll();
            //   // Find_Tank();
            //    refreshPage();
              
            //}
            ClearAll();
            // Find_Tank();
            refreshPage();
        }
        private void ClearAll() 
        {
            listViewtankinvoice.Items.Clear();
            lsvwWaitingTanks.Items.Clear();
            lsvwFixingTanks.Items.Clear();
            lsvwStockTanks.Items.Clear();
            lsvwStock.Items.Clear();
            lstviewInvoiceWithMoney.Items.Clear();
            ListlsvwoutofinvoiceTanks.Items.Clear();
            //_ListlsvwTank.Clear(); 
             _listoflsvwWaitingTanks.Clear();
             _ListlsvwFixingTanks.Clear(); _ListlsvwStockTanks.Clear(); _listoflsvwStock.Clear(); _ListlsvwoutofinvoiceTanks.Clear();
             lsvwdestroyedtanks.Items.Clear();
             _ListlsvwDestroyedtanks.Clear();
             lsvwdestroyedtanks2.Items.Clear();
             _ListlsvwDestroyedtanks2.Clear();

             _lstviewInvoiceWithMoney.Clear();
             
        
        }
        private void Find_Tank()
        {
            /*
              _ListlsvwTank 
                               _listoflsvwWaitingTanks 
                _ListlsvwFixingTanks;_ListlsvwStockTanks; _listoflsvwStock;_listoflsvwInvoices
             */
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                if (string.IsNullOrEmpty(txtCompanyName.Text))
                {

                    selected = db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txttanknumber.Text);
                }
                else
                {
                    if (!string.IsNullOrEmpty(txttanknumber.Text))
                    {
                        selected = db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txttanknumber.Text && x.GazCompanyName == txtCompanyName.Text);
                    }
                    else
                    {

                        selected = db.Tank_Stocks.FirstOrDefault(x => x.GazCompanyName == txtCompanyName.Text);
                    }
                   
                }
                if (null != selected)
                {
                    switch (selected.TankSystemStatus)
                    {
                        case "1":

                            _ListlsvwStockTanks.Add(selected);
                            //FIND A     //במלאי
                            break;
                        case "2": //ממתין לשיפוץ
                            _listoflsvwWaitingTanks.Add(selected);
                            break;
                        case "3": //בשיפוץ
                            _ListlsvwFixingTanks.Add(selected);
                            break;
                        case "4": //יצא לתעודת משלוח
                            _ListlsvwoutofinvoiceTanks.Add(selected);
                            break;
                        case "5": //פסולים
                            _ListlsvwDestroyedtanks.Add(selected);
                            break;
                        case "6": //מושמדים
                            _ListlsvwDestroyedtanks2.Add(selected);
                            break;



                    }
                }
            }
        
        
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //search  accompanion stock by title 

            // 
            // txtAccompanionStockTitle
           // lsvwStock
            FilllsvwlsvwStock();
        }

        private void btnprintDestroyed_Click(object sender, EventArgs e)
        {

            frmReportTankRecipet tanko = new frmReportTankRecipet(5, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(5, "report5");
            //tanko.ShowDialog();
            //}
            //else
            //{
              
                
            //     frmReportTankRecipet tanko = new frmReportTankRecipet(5, "report5",txtSize.Text,txtCompanyName.Text,txttanknumber.Text);
            //tanko.ShowDialog();
            //}
        }

        private void button2_Click(object sender, EventArgs e)
        {
            frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5");
            //    tanko.ShowDialog();
            //}
            //else
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5", txtSize.Text,txtCompanyName.Text, txttanknumber.Text);
            //    tanko.ShowDialog();
            //}
            

        }

        private void button8_Click(object sender, EventArgs e)
        {
            frmReportTankRecipet tanko = new frmReportTankRecipet(3, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
            

            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(3, "report5");
            //    tanko.ShowDialog();
            //}
            //else
            //{

            //    frmReportTankRecipet tanko = new frmReportTankRecipet(3, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            //    tanko.ShowDialog();
            //}

        }

        private void button7_Click(object sender, EventArgs e)
        {
            


            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(2, "report5");
            //    tanko.ShowDialog();
            //}
            //else
            //{

                frmReportTankRecipet tanko = new frmReportTankRecipet(2, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
                tanko.ShowDialog();
        //    }


        }

        private void button5_Click(object sender, EventArgs e)
        {
            frmReportTankRecipet tanko = new frmReportTankRecipet(1, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //   frmReportTankRecipet tanko = new frmReportTankRecipet(1, "report5");
            //tanko.ShowDialog();
            //}
            //else
            //{


            //    frmReportTankRecipet tanko = new frmReportTankRecipet(1, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            //tanko.ShowDialog();
            //}



        }

        private void button9_Click(object sender, EventArgs e)
        {

            frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();

            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5");
            //    tanko.ShowDialog();
            //}
            //else
            //{



            //    frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            //    tanko.ShowDialog();
            //}
        }

        private void button3_Click(object sender, EventArgs e)
        {
            frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();

            //if (string.IsNullOrEmpty(txtSize.Text))
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5");
            //    tanko.ShowDialog();
            //}
            //else
            //{
            //    frmReportTankRecipet tanko = new frmReportTankRecipet(6, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            //    tanko.ShowDialog();
            //}
        }

        private void button4_Click(object sender, EventArgs e)
        {
            ClearAll();
            Filllsvwlsvwtankinvoice();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();

           /* if (string.IsNullOrEmpty(txtSize.Text))
            {
                
                frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5");
                tanko.ShowDialog();

            }
            else
            {

                frmReportTankRecipet tanko = new frmReportTankRecipet(4, "report5", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
                tanko.ShowDialog();

            }*/
        }

        private void button9_Click_1(object sender, EventArgs e)
        {
            //print invoices 2 list 

            frmReportTankRecipet tanko = new frmReportTankRecipet(4, "reportinvoices2", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
        }

        private void button10_Click(object sender, EventArgs e)
        {
            //reportinvoicesAccompanying_stocks.aspx 

            frmReportTankRecipet tanko = new frmReportTankRecipet(4, "reportinvoicesAccompanying_stocks", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
        }

        private void button11_Click(object sender, EventArgs e)
        {

            frmReportTankRecipet tanko = new frmReportTankRecipet(4, "reportinvoicesAccompanying_stocks_log", txtSize.Text, txtCompanyName.Text, txttanknumber.Text);
            tanko.ShowDialog();
        }


   
     
 

    
  
    
    }
}